# coding=utf-8
from common.utils.decorator import sql_wrapper
from common.utils.db import list_object, get, upsert, delete
from common.bank.model import Bank

@sql_wrapper
def get_bank(id):
    if id == 'all':
        banklist = Bank.query.all()
        bank = []
        if banklist:
            for li in banklist:
                bank.append(li.as_dict())
        return bank
    else:
        bank = Bank.query.filter(Bank.id == id).first()
        return bank.as_dict()
